<template>
  <div>
    <!-- 实现一个双向绑定 -->
    <input type="text" :value="value" @input="onInput" v-bind="$attrs" />
  </div>
</template>
<script>
export default {
  inheritAttrs: false,
  props: {
    value: {
      type: String,
      default: "",
    },
  },
  created() {
    console.log(this.value, this.$attrs);
  },
  methods: {
    onInput(e) {
      this.$emit("input", e.target.value);
      // 通知校验
      this.dispatch("el-form-item", "validate");
      this.$parent.$emit("validate");
    },
  },
};
</script>